<template>
  <div class="top-title" @click="go_back">
    <div class="top_left">
      <van-icon name="arrow-left"/>
    </div>
    <div class="top_second">
      {{ title }}
    </div>
  </div>
</template>

<script setup>
import { computed } from 'vue';
import { useRoute } from 'vue-router';
import router from "../Router/index.js";

const route = useRoute();

const title = computed(() => route.meta.title || '未知页面');

function go_back(){
  if (route.meta.title === "数据可视化分析" || route.meta.title === "巡课记录" || route.meta.title === "巡寝记录" || route.meta.title === "导师育人" || route.meta.title === "教师结队" || route.meta.title === "活动发布") {
    router.push("/cqust/index")
  }else {
    router.push("/cqust/userinfo")
  }

}
</script>

<style scoped>
.top-title {
  background-color: #f8f8f8;
  padding: 10px;
  text-align: left;
  font-size: 23px;
  color: #682757;
}


.top-title {
  height: 40px;
  background-color: #f8f8f8;
  padding: 10px;
  text-align: left;
  font-size: 20px;
  color: #682757;
  line-height: 40px;
  overflow: hidden;
}
.top_left{
  display: inline-block;
}
.top_second{
  display: inline-block;
  margin-left: 10px;
}
</style>
